/**
 * 
 */
package br.com.movelaria.modelo;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;

/**
 * @author fabricio
 *
 */
@Embeddable
public class OperacaoPecaId implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2589696377931567504L;

	@ManyToOne(fetch = FetchType.LAZY)
	private Operacao operacao;
	
	@ManyToOne(fetch = FetchType.LAZY)
	private Peca peca;

	public Operacao getOperacao() {
		return operacao;
	}

	public void setOperacao(Operacao operacao) {
		this.operacao = operacao;
	}

	public Peca getPeca() {
		return peca;
	}

	public void setPeca(Peca peca) {
		this.peca = peca;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((peca == null) ? 0 : peca.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		OperacaoPecaId other = (OperacaoPecaId) obj;
		if (peca == null) {
			if (other.peca != null)
				return false;
		} else if (!peca.equals(other.peca))
			return false;
		return true;
	}
	
	
}
